package org.pink6.FileBrowser4;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import java.io.*;

public class textViewer extends Activity {
	
    private TextView titleText;
    private TextView bodyText;
    private String file_path;
    private String file_name;
    private BufferedReader br;
    private String input;
    
    @Override
    protected void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        
        setContentView(R.layout.text_view);
        
        titleText = (TextView) findViewById(R.id.title);
        bodyText = (TextView) findViewById(R.id.body);
        
        Bundle extras = getIntent().getExtras();
        this.file_path = extras.getString(FileBrowser4.FILE_PATH);
        this.file_name = extras.getString(FileBrowser4.FILE_NAME);
        
        try {
        	br = new BufferedReader(new FileReader(file_path));
        	input = br.readLine();
        } catch(IOException e) {
        	//
        }
        
        
        String title = file_name;
        String body = input+input+input; //test

       	if (title != null) {
       		titleText.setText(title);
       	}
       	if (body != null) {
       		bodyText.setText(body);
       	}
    }
}